/*
 * **.cpp - 
 *
 * Copyright (C) 2010-2011 Serge Begger
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef POWERCONF_H
#define POWERCONF_H

#include <QWidget>
#include <QTimer>
#include "netpower/netpower.h"

namespace Ui {
    class powerconf;
}

class powerconf : public QWidget
{
    Q_OBJECT

public:
    explicit powerconf(QWidget *parent = 0);
    bool deviceEnabled();
    ~powerconf();

public slots:
    void rereadData();
    void writeData();

private:
    Ui::powerconf *ui;
    netpower *netpowerDevice;
    QTimer *timer;
    bool firstRead;
    QString up(int inc,int max = 255);
    QString down(int);
    QString upVolt(double);
    QString downVolt(double);
    void setSleepStatus(bool state);
    void setCheckPCStatus(bool state);


private slots:
    void endTimer();
    void on_pb_CHECKPC_clicked(bool state);
    void on_pb_SLEEP_clicked(bool state);
    void on_pb_ACCON_Up_pressed();
    void on_pb_ACCON_Dwn_pressed();
    void on_pb_POWON_Up_pressed();
    void on_pb_POWON_Dwn_pressed();
    void on_pb_ROUT_Up_pressed();
    void on_pb_ROUT_Dwn_pressed();
    void on_pb_BATTOFF_Up_pressed();
    void on_pb_BATTOFF_Dwn_pressed();
    void on_pb_ACCOFF_Up_pressed();
    void on_pb_ACCOFF_Dwn_pressed();
    void on_pb_OSSHDWNTIME_up_pressed();
    void on_pb_OSSHDWNTIME_Dwn_pressed();
    void on_pb_BATMIN_up_pressed();
    void on_pb_BATMIN_Dwn_pressed();
    void on_pb_BATMAX_up_pressed();
    void on_pb_BATMAX_Dwn_pressed();
};

#endif // POWERCONF_H
